home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Mar. 14, 1997
- // Author: laf
- //
- // Description:
- // The revolvePreset() procedure executes a revolve operation on each
- // selected object.
- //
-
- global proc revolvePreset( int $doHistory, int $outputPolys,
- int $partialCrvRange, float $startSweep,
- float $endSweep, int $useTol, float $tol,
- int $degree, int $numSegments, int $useLocalPivot,
- float $axisX, float $axisY, float $axisZ,
- float $pivotX, float $pivotY, float $pivotZ )
- {
- // Get a list of curves to revolve and execute the revolve cmd on each.
- // Allowable curves: nurbsCurves, isoparms, cos, surf edges
- //
- global int $gSelectNurbsCurvesBit;
- global int $gSelectIsoparmsBit;
- global int $gSelectCurvesOnSurfacesBit;
- global int $gSelectSurfaceEdgeBit;
- global int $gSelectMeshEdge;
-
- // Piece together the revolve command
- //
- string $cmd;
- $cmd = ( "revolve " +
- " -ch " + $doHistory + " -po " + $outputPolys +
- " -rn " + $partialCrvRange + " -ssw " + $startSweep +
- " -esw " + $endSweep + " -ut " + $useTol + " -tol " + $tol +
- " -degree " + $degree + " -s " + $numSegments +
- " -ulp " + $useLocalPivot +
- " -ax " + $axisX + " " + $axisY + " " + $axisZ );
-
- if( ! $useLocalPivot ) {
- $cmd = $cmd + " -p " + $pivotX + " " + $pivotY + " " + $pivotZ;
- }
-
- string $curveList[] = `filterExpand -ex true -sm $gSelectMeshEdge -sm $gSelectNurbsCurvesBit -sm $gSelectIsoparmsBit -sm $gSelectCurvesOnSurfacesBit -sm $gSelectSurfaceEdgeBit`;
-
- if( size($curveList) > 0 ) {
- $cmd += " %s;";
- string $revolveResults[] = executeForEachObject( $curveList, $cmd );
- if( (size($revolveResults)) == 0 ) {
- error("Revolve: Failed on the selected objects.");
- }
- else {
- // Select all the results with one select command. Note that only
- // resulting surfaces are selected, not dependency nodes.
- //
- string $selectString;
- $selectString = "select ";
- int $i;
-
- int $numResults = size($revolveResults);
- for( $i = 0; $i < $numResults; $i ++ ) {
- $selectString += $revolveResults[$i];
- $selectString += " ";
- }
- $selectString += ";";
- select -cl;
- eval($selectString);
- }
- }
- else {
- error( "Revolve: No valid items selected." );
- }
- }
-
-